# coding=utf-8

import os

from distutils.core import setup

# 不是包的列表
exclude_package_list: list[str] = list()
exclude_package_list.append('.idea')
exclude_package_list.append('__pycache__')
exclude_package_list.append('adam3.egg-info')

# 包列表
package_list: list[str] = list()

def recursive_listdir(path):
    """
    遍历目录下的所有目录
    """

    files = os.listdir(path)
    for file in files:
        file_path = os.path.join(path, file)
        if os.path.isdir(file_path):
            package = file_path.replace("C:/mywork/gitcode-repository/hades/dev-project/adam3", "").replace("\\", "/")[1:]

            if contain(package, exclude_package_list):
                continue

            package_list.append(package)
            recursive_listdir(file_path)

def contain(_package, _exclude_package_list):
    """
    判断是否包含在列表中
    """

    for exclude_package in _exclude_package_list:
        if exclude_package in _package:
            return True

recursive_listdir('C:/mywork/gitcode-repository/hades/dev-project/adam3')
print(package_list)

setup(
    name='adam3',
    version='1.0',
    author='李珅',
    author_email='913071727@qq.com',
    maintainer='李珅',
    maintainer_email='913071727@qq.com',
    url='',
    packages=package_list
)
